#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(void)
{
	int fd;
	int ret;

	fd = open("./test.txt",O_WRONLY | O_CREAT | O_EXCL,0644);
	if(-1 == fd){
		printf("Open Error !\n");
		return 1;
	}
	printf("Open Successful !\n");

	ret = write(fd,"Hello World",11);
	if(-1 == ret){
		printf("Write Error !\n");
		close(fd);
		return 1;
	}
	printf("Write :%d bytes OK !\n",ret);

	close(fd);

	return 0;
}
